import static com.github.llyb120.workflow.definition.All.*

workflow {
    id("flow3")

    startnode "发起", {
        dealer {
            byRoleName("管理员")
        }
        to "审批", {

        }
    }

    node "审批", {
        dealer {
            byRoleName("管理员", "基础角色")
            expression {

            }

            expression { ctx ->
                def users = ctx.users
                def publisher = ctx.publisher
                if(publisher.hasRole("正职")){
                    return users.filter(e -> e.hasRole("副职"))
                } else if(publisher.hasRole("副职")){
                    return users.filter(e -> e.hasRole("正职"))
                }
            }
        }
        to "结束"
    }

    endnode "结束", {}
}
